package bishi;

import java.awt.image.BandedSampleModel;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.Map;
import java.util.Scanner;

/**
 * @Author liuhaoqi
 * @Date 2020/8/31 20:46
 * @Version 1.0
 */
public class T58_01 {
    public static void main(String[] args) {
        Scanner scanner = new Scanner(System.in);
        String str = scanner.nextLine();
        String s = str.replaceAll("\\[", "").replaceAll("\\]", "")
                .replaceAll(",", "").replaceAll(" ","");
        ArrayList<Integer> list = new ArrayList<>();
        for (int i = 0; i < s.length(); i++) {
            list.add(Integer.parseInt(s.charAt(i) + ""));
        }
        HashMap<Integer, int[]> map = new HashMap<>();
        for (int i = 0; i < list.size(); i+=2) {
            int[] ints = new int[2];
            ints[0] = list.get(i);
            ints[1] = list.get(i+1);
            map.put(i, ints);
        }
        Integer[] arr = list.toArray(new Integer[list.size()]);

        int min = Integer.MAX_VALUE;
        int ans = 0;
        for (int i = 0; i <arr.length-1 ; i+=2) {
            for (int j = i + 2; j < arr.length - 1; j += 2) {
                int one = arr[j] - arr[i];
                int two = arr[j + 1] - arr[i + 1];
                ans = one * one + two * two;
                ans = (int) Math.sqrt(ans);
                if (ans < min) {
                    min = ans;
                    continue;
                }
            }
        }
        System.out.println(min);
//        System.out.println(arr[marki] + " " + arr[marki + 1]);
//        System.out.println(arr[markj] + " " + arr[markj + 1]);

    }
}
